﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BoolanElement
{
    public class RichTextCoder
    {

        public static String RtfToBase64(string src)
        {
            String ret=Convert.ToBase64String(Encoding.Unicode.GetBytes(src));
            return ret;
        }

        public static String Base64ToRtf(String src)
        {
            try
            {
                System.Text.UnicodeEncoding encoding = new System.Text.UnicodeEncoding();
                byte[] data = Convert.FromBase64String(src);
                string ret = encoding.GetString(data, 0, data.Length);
                return ret;
            }
            catch(Exception e){}
            return "";
        }
    }
}
